home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
progba_1
/
ctlprogb.ctl
next >
Wrap
Text File
|
1999-01-05
|
36KB
|
881 lines
VERSION 5.00
Begin VB.UserControl ProgBar
Alignable = -1 'True
BackColor = &H00FFFFFF&
CanGetFocus = 0 'False
ClientHeight = 1290
ClientLeft = 0
ClientTop = 0
ClientWidth = 4425
ClipControls = 0 'False
FillColor = &H00FF0000&
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
ScaleHeight = 86
ScaleMode = 3 'Pixel
ScaleWidth = 295
ToolboxBitmap = "ctlProgBar.ctx":0000
End
Attribute VB_Name = "ProgBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'===========================================================
'= ProgBar Control V1.2.1 =
'= ---------------------- =
'= (C)1998 NE =
'= NE94252@netscape.net =
'= =
'= You may use this source code within your own =
'= applications. You may not distribute it on a website =
'= or ftp site without my express permission. =
'===========================================================
'= Updates: =
'= -------- =
'= V1.1 - Addition of the VerticalText property. =
'= - General code clean up. =
'= - Addition of the ability to play a wav =
'= file at 100%. =
'= V1.2 - Addition of gradient fill (BarStyle). =
'= - All bar and background drawing handled =
'= by APIs to speed things up. =
'= - The ability to wait for the sound to =
'= finish or not before realsing to code. =
'= V1.2.1 - Fixed a problem with the use of =
'= reserved words. =
'===========================================================
'= RunTime Properties: (Aphabetical order) =
'= ------------------- =
'= BackColour - The back ground colour of the bar. =
'= Standard colour range. =
'= BarEndColour - The colour the bar fades into when the =
'= 'BarStyle' is Gradient. =
'= Standard colour range. =
'= BarStartColour- The colour the bar fades from or the =
'= colour of the bar if the 'BarStyle' is =
'= Solid. Standard colour range. =
'= BarStyle - The style of bar fill (gradient or =
'= solid). =
'= 0 = Gradiant, 1 = Solid. =
'= BorderStyle - Standard border style. =
'= 0 = Flat, 1 = ThreeD =
'= FillDirection - The direction the bar should fill. =
'= 0 = Up, 1 = Down, 2 = Left, 3 = Right =
'= FontColour - The colour of the text displayed. =
'= Standard colour range. =
'= Max - The upper limit of the bar. =
'= Long value, -2147483648 to 2147483647 =
'= Message - The message to display in the bar. =
'= String. =
'= Min - The lower limit of the progress bar. =
'= Long value, -2147483648 to 2147483647 =
'= Percent - The current bar percentage. =
'= Byte value, 0 to 100 (obviously :)) =
'= PlaySound - Flag to indicate the sound file =
'= specified in the SoundToPlay property =
'= sould be played when 100% is reached. =
'= (TRUE, FALSE) =
'= ShowMessage - Flag to indicate the message should be =
'= shown. (TRUE, FALSE) =
'= ShowPercent - Flag to incicate the current percentage =
'= should be shown. (TRUE, FALSE) =
'= ShowValue - Flag to indicate the current value =
'= should be shown. (TRUE, FALSE) =
'= SoundToPlay - A string value holding the path and =
'= name of the wav file to play @ 100%. =
'= Value - The current value of the progress bar. =
'= Long value, -2147483648 to 2147483647 =
'= VerticalText - Flag to indicate that the text should =
'= be written top to bottom, useful for up =
'= or down progress bars. (TRUE, FALSE) =
'= WaitForSound - This flag indicates that the code will =
'= susspend until the sound file played at =
'= 100% has finished playing. If one's =
'= set to play that is. (TRUE, FALSE) =
'===========================================================
'= Notes: =
'= ------ =
'= 1. You can either show the percentage or value or =
'= neither. You can't show both. Setting one will =
'= disable the other. =
'= 2. Setting the value above the 'Max' or below the 'Min' =
'= will result in the value being set to the 'Max' or =
'= 'Min'. =
'= 3. Setting the percent above 100 or below 0 will result =
'= in the percentage being changed. =
'= 4. Setting the 'Max' below the 'Min' will result in the =
'= 'Max' being set to the 'Min' + 1. =
'= 5. Setting the 'Min' below the 'Max' will result in the =
'= 'Min' being set to the 'Max' - 1. =
'= 6. Adjusting either the 'Max' or the 'Min' will cause =
'= the 'Value' to be recalculated. =
'= 7. If the 'BarStyle' is set to solid the colour of the =
'= bar is defined by the 'BarStartColour' property. =
'= 8. If a sound is playing and the flag to play one at =
'= 100% is set the currently playing file will stop and =
'= the specified one will play. =
'===========================================================
'= Have fun! NE =
'===========================================================
Option Explicit
'API and constant to play wav file.
Private Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_SYNC = &H0
Private Const SND_ASYNC = &H1
'API's, type and constants for the bar fills.
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long
Private Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Type RECT
vLeft As Long
vTop As Long
vRight As Long
vBottom As Long
End Type
Private Const PLANES = 14
Private Const BITSPIXEL = 12
'Fill direction list.
Public Enum FillDirection
pbUp
pbDown
pbLeft
pbRight
End Enum
'Border style list.
Public Enum BorderStyles
pbNone
pbFixedSingle
End Enum
'Appearance style list.
Public Enum AppearanceStyles
pbFlat
pbThreeD
End Enum
'Bar style list.
Public Enum BarStyle
pbGradient
pbSolid
End Enum